package com.wf.day_0614.test1;


/**
 * 懒汉式
 * 线程不安全
 *
 * @author mpk16
 */
public class Singleton {
    private static Singleton instance;

    private Singleton() {
    }

    public synchronized static Singleton getInstance() {


            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
            if (instance == null) {

                instance = new Singleton();
            }

            return instance;

    }
}
